<template>
	<view>
		<view v-if="infoData">
			<view style="background-color: #ffffff;">
				<u-cell-group :border="false">
					<u-cell  title="本人图像" :value="infoData.instructorName">
						<view slot="value" class="u-slot-value" >
							<image :src="infoData.instructorImg" style="width: 120rpx;height: 120rpx;border-radius: 160rpx;overflow: hidden;"></image>
						</view>
					</u-cell>
					<u-cell  title="真实姓名" :value="infoData.instructorName"></u-cell>
					<u-cell  title="出生日期" :value="infoData.instructorBirthday"></u-cell>
					<u-cell  title="登录账号" :value="infoData.account"></u-cell>
					<u-cell  title="手机号码" :value="infoData.instructorPhone"></u-cell>
					<u-cell  title="从业时间" :border="false" :value="infoData.serviceYears"></u-cell>
				</u-cell-group>
				<view class="height30 bg-f1f1f1"></view>
				<view>
					<u-cell-group :border="false">
						<u-cell  title="个人简介"></u-cell>
					</u-cell-group>
					<view class="txt">
						{{  infoData.instructorIntro || '待完善'  }}
					</view>
				</view>
				<view class="height30 bg-f1f1f1"></view>
				<view>
					<u-cell-group :border="false">
						<u-cell  title="从教经验"></u-cell>
					</u-cell-group>
					<view class="txt">
						{{  infoData.experienceFromTeaching || '待完善'  }}
					</view>
				</view>
				<view class="height30 bg-f1f1f1"></view>
				<view>
					<u-cell-group :border="false">
						<u-cell  title="教学成果"></u-cell>
					</u-cell-group>
					<view class="txt">
						<view  class="album" >
							<view class="aimage">
								<view v-for="(item, index) in teachingOutcomesFileList" :key="index">
									<image :src="item"></image>
								</view>
							</view>
						</view>
						{{  infoData.teachingOutcomes || '待完善'  }}
					</view>
				</view>
				<view class="height30 bg-f1f1f1"></view>
				<view>
					<u-cell-group :border="false">
						<u-cell  title="所获荣誉"></u-cell>
					</u-cell-group>
					<view class="txt">
						<view  class="album" >
							<view class="aimage">
								<view v-for="(item, index) in honorsFileList" :key="index">
									<image :src="item"></image>
								</view>
							</view>
						</view>
						{{  infoData.honors || '待完善'  }}
					</view>
				</view>
			</view>
			<view style="padding: 30rpx;">
				<u-button text="完善我的信息" @click="edit" color="#155CCF"></u-button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				//用户信息
				infoData: null,
				//教学经验图
				teachingOutcomesFileList: [],
				//荣誉证书
				honorsFileList: []
			}
		},
		onShow() {
			this.getInstructorData();
		},
		methods: {
			//获取当前登录用户信息
			getInstructorData(){
				var url = '/blade-merchant-app/merchant-app/instructor/getInstructorInfo';
				uni.showLoading({
					title: '加载中',
					mask: true
				})
				this.$request({
					url: url,
					type: 'GET'
				}).then(res => {
					uni.hideLoading();
					this.infoData = res.data;
					//教学成果
					if(res.data.teachingOutcomesFile){
						this.teachingOutcomesFileList = res.data.teachingOutcomesFile.split(",");
					}
					//所获荣誉
					if(res.data.honorsFile){
						this.honorsFileList = res.data.honorsFile.split(",");
					}
				})
			},
			//完善生涯资料
			edit(){
				uni.navigateTo({
					url: '/pagesBusiness/pages/user/instructorInfo/edit/edit'
				})
				
			}
		}
	}
</script>

<style lang="scss">
	page {
		background: #f1f1f1;
	}
	.height30 {
		height: 30rpx;
	}
	.bg-f1f1f1 {
		background: #f1f1f1;
	}
	.txt{
		padding: 12px 15px;
		color: #606266;
		font-size: 14px;
		line-height: 18px;
	}
	.album {
		padding-bottom:20rpx;
		
		.aimage {
			display: flex; flex-direction: row; flex-wrap: wrap; align-items: center; 
			
			image {
				width: 200rpx;height: 200rpx;padding-right: 15rpx;border-radius: 10rpx;overflow: hidden;
			}
		}
	}
</style>
